
// initial state
let state = {
  navbarHeight: '50px',
  sidebarWidth: '210px',
  isCollapse: false
}

const layout = window.localStorage.getItem('layout')
if (layout) {
  state = JSON.parse(layout)
}

/**
 * Getters
 * @type {import('vuex/types').GetterTree<typeof state>}
 */
const getters = {

}
/**
 * Mutations
 *  @type {import('vuex/types').MutationTree<typeof state>}
 */
const mutations = {
  setNavbarHeight(state, data) {
    state.navbarHeight = data
  },
  setSidebarWidth(state, data) {
    state.isCollapse = data
    if (data) {
      state.sidebarWidth = '64px'
    } else {
      state.sidebarWidth = '210px'
    }
  },
}
/**
 * Actions
 *  @type {import('vuex/types').ActionTree<typeof state>}
 */
const actions = {

}

export default {
  namespaced: true, // 为模块开启命名空间
  state,
  getters,
  mutations,
  actions
}
